import Vue from 'vue'
import Router from 'vue-router'
import Navigate from '@/components/navigate/navigate'
const home = () => import('@/components/home/home')
const my = () => import('@/components/my/my')
const ask = () => import('@/components/ask/ask')
const search = () => import('@/components/search/search')
const login = () => import('@/components/login/login')
const register = () => import('@/components/register/register')
const forget = () => import('@/components/forget/forget')
const details = () => import('@/components/details/details')
Vue.use(Router)

const router = new Router({
  /* routes: [
    {
      path: '/',
      component: App, 
      children: [
        {
          path: '/',
          redirect: '/navigate'
        },
        {
          path: '/login',
          component: login,
        },
        { 
          path: '/register', 
          component: register
        },
        { 
          path: '/forget',
          component: forget 
        },
        { 
          path: '/ask/details',
          component: details 
        },
        {
          path: '/navigate',
          component: Navigate,
          children: [
            {
              path: '/',
              redirect: '/index'
            },
            {
              path: '/index',
              name: 'index',
              component: home
            },
            {
              path: '/search',
              name: 'search',
              component: search
            },
            {
              path: '/my',
              name: 'my',
              component: my
            },
            {
              path: '/ask',
              name: 'ask',
              component: ask
            },
          ]
        }
      ]
    }
  ] */

  routes: [
    {
      path: '/',
      redirect: '/index'
    },
    {
      path: '/login',
      component: login,
    },
    { 
      path: '/register', 
      component: register
    },
    { 
      path: '/forget',
      component: forget 
    },
    { 
      path: '/ask/details',
      component: details 
    },
    {
      path: '/navigate',
      component: Navigate,
      children: [
        {
          path: '/index',
          name: 'index',
          component: home
        },
        {
          path: '/search',
          name: 'search',
          component: search
        },
        {
          path: '/my',
          name: 'my',
          component: my
        },
        {
          path: '/ask',
          name: 'ask',
          component: ask
        },
      ]
    }
    
  ]
})

export default router